From 8f7aab31da86a6f753c5d6205fdcbd6bd95cb50e Mon Sep 17 00:00:00 2001 From: saratnt Date: Fri, 10 Nov 2023 09:08:20 +0100 Subject: [PATCH 1/2] Updated Forger Stake native smart contract Solidity interface --- .../account/smart_contract_resources/contracts/ForgerStakes.sol | 2 ++ 1 file changed, 2 insertions(+) diff --git a/qa/SidechainTestFramework/account/smart_contract_resources/contracts/ForgerStakes.sol b/qa/SidechainTestFramework/account/smart_contract_resources/contracts/ForgerStakes.sol index 45f1c7d519..8c8aa5edd6 100644 --- a/qa/SidechainTestFramework/account/smart_contract_resources/contracts/ForgerStakes.sol +++ b/qa/SidechainTestFramework/account/smart_contract_resources/contracts/ForgerStakes.sol @@ -20,4 +20,6 @@ interface ForgerStakes { function delegate(bytes32 publicKey, bytes32 vrf1, bytes1 vrf2, address owner) external payable returns (StakeID); function withdraw(StakeID stakeId, bytes1 signatureV, bytes32 signatureR, bytes32 signatureS) external returns (StakeID); + + function openStakeForgerList(uint32 forgerIndex, bytes32 signature1, bytes32 signature2) external returns (bytes memory); } From b7951024007b487ebed1e64d4326b0a6155f4edb Mon Sep 17 00:00:00 2001 From: saratnt Date: Fri, 10 Nov 2023 09:08:49 +0100 Subject: [PATCH 2/2] Added examples of calling natvive smart contracts from Solidity to release notes --- doc/release/0.9.0.md | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/doc/release/0.9.0.md b/doc/release/0.9.0.md index 43759246d5..0a5df6fc39 100644 --- a/doc/release/0.9.0.md +++ b/doc/release/0.9.0.md @@ -13,6 +13,39 @@ The EVM Smart Contract can invoke a Native Smart Contract function using the fol `delegatecall` and `callcode` cannot be used instead, they will return an error in case they are used with Native Smart Contracts. +In addition, it is possible to use the Solidity interface describing the Native Smart Contract. +Files with the Native Smart Contract Solidity interfaces can be found under: +`qa/SidechainTestFramework/account/smart_contract_resources/contracts/`. + +Example of Native Smart Contract invocation in Solidity using low-level `staticcall` function: + +``` + // ... +address contractAddr = address(0x0000000000000000000022222222222222222222); +(bool success, bytes memory result) = contractAddr.staticcall{gas: 100000}( + abi.encodeWithSignature("getAllForgersStakes()") +); + + // ... +``` + +Example using Solidity interface: + +``` +import "./ForgerStakes.sol"; + + // ... + ForgerStakes nativeContract = ForgerStakes(0x0000000000000000000022222222222222222222); + nativeContract.getAllForgersStakes{gas: 100000}(); + + // ... + +``` + + + + + --- ## Update instructions from previous version