Skip to content

Commit

Permalink
Update deposit precompile interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
boundless-forest committed Aug 12, 2024
1 parent fe98c3a commit 395df9a
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 1 deletion.
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);
}

0 comments on commit 395df9a

Please sign in to comment.