Skip to content

Commit 6c523ed

Browse files
authored
ovault examples (#1588)
Signed-off-by: shankar <shankar@layerzerolabs.org>
1 parent 34e5d1b commit 6c523ed

32 files changed

Lines changed: 2839 additions & 0 deletions

examples/ovault-evm/.env.example

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# .-.-. .-.-. .-.-. .-.-. .-.-. .-.-. .-.-. .-.-
2+
# / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \
3+
# `-' `-`-' `-`-' `-`-' `-`-' `-`-' `-`-' `-`-'
4+
#
5+
# Example environment configuration
6+
#
7+
# .-.-. .-.-. .-.-. .-.-. .-.-. .-.-. .-.-. .-.-
8+
# / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \
9+
# `-' `-`-' `-`-' `-`-' `-`-' `-`-' `-`-' `-`-'
10+
11+
# By default, the examples support both mnemonic-based and private key-based authentication
12+
#
13+
# You don't need to set both of these values, just pick the one that you prefer and set that one
14+
MNEMONIC=
15+
PRIVATE_KEY=
16+
PRIVATE_KEY_HYPERLIQUID=
17+
18+
RPC_HYPEREVM_MAINNET=https://rpc.hyperliquid.xyz/evm
19+
RPC_HYPEREVM_TESTNET=https://rpc.hyperliquid-testnet.xyz/evm
20+
21+
HYPEREVM_COMPOSER=
22+
HYPEREVM_OFT=
23+
SRC_OFT=
24+
SRC_EID=
25+
DST_EID=

examples/ovault-evm/.eslintignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
artifacts
2+
cache
3+
dist
4+
node_modules
5+
out
6+
*.log
7+
*.sol
8+
*.yaml
9+
*.lock
10+
package-lock.json

examples/ovault-evm/.eslintrc.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
require('@rushstack/eslint-patch/modern-module-resolution');
2+
3+
module.exports = {
4+
root: true,
5+
extends: ['@layerzerolabs/eslint-config-next/recommended'],
6+
rules: {
7+
// @layerzerolabs/eslint-config-next defines rules for turborepo-based projects
8+
// that are not relevant for this particular project
9+
'turbo/no-undeclared-env-vars': 'off',
10+
'import/no-unresolved': 'warn', // Updated to warn to avoid erratic popping up of this particular error for '@layerzerolabs/metadata-tools' even when the package has been installed correctly
11+
},
12+
};

examples/ovault-evm/.gitignore

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
node_modules
2+
.env
3+
coverage
4+
coverage.json
5+
typechain
6+
typechain-types
7+
8+
# Hardhat files
9+
cache
10+
artifacts
11+
12+
13+
# LayerZero specific files
14+
.layerzero
15+
16+
# foundry test compilation files
17+
out
18+
19+
# pnpm
20+
pnpm-error.log
21+
22+
# Editor and OS files
23+
.DS_Store
24+
.idea
25+
26+
broadcast
27+
deployments

examples/ovault-evm/.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
v18.18.0
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
artifacts/
2+
cache/
3+
dist/
4+
node_modules/
5+
out/
6+
*.log
7+
*ignore
8+
*.yaml
9+
*.lock
10+
package-lock.json
11+
package.json

examples/ovault-evm/.prettierrc.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
...require('@layerzerolabs/prettier-config-next'),
3+
};

examples/ovault-evm/README.md

Lines changed: 621 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// SPDX-License-Identifier: UNLICENSED
2+
pragma solidity ^0.8.20;
3+
4+
import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
5+
import { OFT } from "@layerzerolabs/oft-evm/contracts/OFT.sol";
6+
7+
contract MyAssetOFT is OFT {
8+
constructor(
9+
string memory _name,
10+
string memory _symbol,
11+
address _lzEndpoint,
12+
address _delegate
13+
) OFT(_name, _symbol, _lzEndpoint, _delegate) Ownable(_delegate) {}
14+
15+
function mint(address to, uint256 amount) external {
16+
_mint(to, amount);
17+
}
18+
19+
function burn(address from, uint256 amount) external {
20+
_burn(from, amount);
21+
}
22+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// SPDX-License-Identifier: UNLICENSED
2+
pragma solidity ^0.8.22;
3+
4+
import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
5+
6+
import { OVault } from "@layerzerolabs/ovault-evm/contracts/OVault.sol";
7+
import { OFTAdapter } from "@layerzerolabs/oft-evm/contracts/OFTAdapter.sol";
8+
9+
contract MyOVault is OVault {
10+
constructor(string memory name, string memory symbol, address asset) OVault(name, symbol, asset) {}
11+
}
12+
13+
contract MyShareOFTAdapter is OFTAdapter {
14+
constructor(
15+
address _token,
16+
address _lzEndpoint,
17+
address _delegate
18+
) OFTAdapter(_token, _lzEndpoint, _delegate) Ownable(_delegate) {}
19+
}

0 commit comments

Comments
 (0)