Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update deposit precompile interfaces #1561

Merged
merged 1 commit into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions precompile/deposit/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,15 @@ where

Ok(true)
}

#[precompile::public("migrate()")]
fn migrate(handle: &mut impl PrecompileHandle) -> EvmResult<bool> {
let origin: AccountIdOf<Runtime> = handle.context().caller.into();
RuntimeHelper::<Runtime>::try_dispatch(
handle,
Some(origin).into(),
darwinia_deposit::Call::<Runtime>::migrate {},
)?;
Ok(true)
}
}
1 change: 1 addition & 0 deletions precompile/deposit/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ fn selectors() {
assert!(PCall::lock_selectors().contains(&0x998e4242));
assert!(PCall::claim_selectors().contains(&0x4e71d92d));
assert!(PCall::claim_with_penalty_selectors().contains(&0xfa04a9bf));
assert!(PCall::migrate_selectors().contains(&0x8fd3ab80));
}

#[test]
Expand Down
21 changes: 20 additions & 1 deletion precompile/metadata/abi/deposit.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,20 @@
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "migrate",
"outputs":
[
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
}
],
"devdoc":
Expand Down Expand Up @@ -104,6 +118,10 @@
{
"_0": "returns true on success, false otherwise."
}
},
"migrate()":
{
"details": "Migrate data to deposit contract"
}
},
"title": "Deposit",
Expand All @@ -113,7 +131,8 @@
{
"claim()": "4e71d92d",
"claim_with_penalty(uint8)": "fa04a9bf",
"lock(uint256,uint8)": "998e4242"
"lock(uint256,uint8)": "998e4242",
"migrate()": "8fd3ab80"
}
}
},
Expand Down
3 changes: 3 additions & 0 deletions precompile/metadata/sol/deposit.sol
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,7 @@ interface Deposit {
/// @param depositId The deposit ticket wish to claim
/// @return returns true on success, false otherwise.
function claim_with_penalty(uint8 depositId) external returns (bool);

/// @dev Migrate data to deposit contract
function migrate() external returns (bool);
}