-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add vesting pallet precompile (#442)
* Add vesting pallet precompile * make test pass * clippy fix * fix imports * fix staking-precompile tests * add more tests to vesting precompile * fix vested transfer test * non vested account cannot vest others * clippy fix * add some more tests --------- Co-authored-by: salman01zp <[email protected]>
- Loading branch information
1 parent
7876032
commit b3b9eb8
Showing
14 changed files
with
863 additions
and
13 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
[package] | ||
name = "pallet-evm-precompile-vesting" | ||
version = "0.1.0" | ||
authors = { workspace = true } | ||
edition = "2021" | ||
description = "A Precompile to make pallet-vesting calls encoding accessible to pallet-evm" | ||
|
||
[dependencies] | ||
log = { workspace = true } | ||
num_enum = { workspace = true } | ||
rustc-hex = { workspace = true } | ||
|
||
# Moonbeam | ||
precompile-utils = { workspace = true } | ||
|
||
# Substrate | ||
frame-support = { workspace = true } | ||
frame-system = { workspace = true } | ||
pallet-balances = { workspace = true } | ||
pallet-vesting = { workspace = true } | ||
parity-scale-codec = { workspace = true, features = ["derive"] } | ||
sp-core = { workspace = true } | ||
sp-runtime = { workspace = true } | ||
sp-std = { workspace = true } | ||
|
||
# Frontier | ||
evm = { workspace = true, features = ["with-codec"] } | ||
fp-evm = { workspace = true } | ||
pallet-evm = { workspace = true, features = ["forbid-evm-reentrancy"] } | ||
|
||
tangle-primitives = { workspace = true } | ||
|
||
[dev-dependencies] | ||
derive_more = { workspace = true } | ||
hex-literal = { workspace = true } | ||
serde = { workspace = true } | ||
sha3 = { workspace = true } | ||
|
||
# Moonbeam | ||
precompile-utils = { workspace = true, features = ["std", "testing"] } | ||
|
||
# Substrate | ||
pallet-balances = { workspace = true, features = ["std"] } | ||
pallet-timestamp = { workspace = true, features = ["std"] } | ||
scale-info = { workspace = true, features = ["derive", "std"] } | ||
sp-io = { workspace = true, features = ["std"] } | ||
|
||
[features] | ||
default = ["std"] | ||
std = [ | ||
"fp-evm/std", | ||
"frame-support/std", | ||
"frame-system/std", | ||
"pallet-balances/std", | ||
"pallet-evm/std", | ||
"pallet-vesting/std", | ||
"parity-scale-codec/std", | ||
"precompile-utils/std", | ||
"sp-core/std", | ||
"sp-runtime/std", | ||
"sp-std/std", | ||
"tangle-primitives/std", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// SPDX-License-Identifier: GPL-3.0-only | ||
pragma solidity >=0.8.3; | ||
|
||
/// @dev The Vesting contract's address. | ||
address constant VESTING_ADDRESS = 0x0000000000000000000000000000000000000801; | ||
|
||
/// @dev The Vesting contract's instance. | ||
Vesting constant VESTING_CONTRACT = Vesting(VESTING_ADDRESS); | ||
|
||
/// @author The Tangle Team | ||
/// @title Pallet Vesting Interface | ||
/// @title The interface through which solidity contracts will interact with the Vesting pallet | ||
/// @custom:address 0x0000000000000000000000000000000000000801 | ||
interface Vesting { | ||
/// @dev Unlock any vested funds of the sender account. | ||
function vest() external returns (uint8); | ||
|
||
/// @dev Unlock any vested funds of a `target` account. | ||
/// @param target The address of the account to unlock vested funds for. | ||
function vestOther(bytes32 target) external returns (uint8); | ||
|
||
/// @dev Create a vested transfer. | ||
/// @param target The address of the account to transfer funds to. | ||
/// @param index The index of the vesting schedule to transfer. | ||
function vestedTransfer(bytes32 target, uint8 index) external returns (uint8); | ||
} |
Oops, something went wrong.