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

fix: correct precompile interface and json abi #462

Merged
merged 14 commits into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from 13 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
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@
"anonymous": false,
"inputs": [
{
"indexed": false,
"indexed": true,
"internalType": "address",
"name": "from",
"type": "address"
},
{
"indexed": true,
"internalType": "bytes32",
"name": "destination",
"type": "bytes32"
Expand Down
4 changes: 2 additions & 2 deletions precompiles/metadata/precompiles-creditcoin3-devnet.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"name": "SubstrateTransfer",
"bytecode": "0xfe",
"compiler": "Not Installed",
"source": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity >=0.8.3;\n\n/// @dev The Deposit precompile address\naddress constant SUBSTRATE_TRANSFER_ADDRESS = 0x0000000000000000000000000000000000000Fd1;\n\nSubstrateTransfer constant SUBSTRATE_TRANSFER_ADRRESS = SubstrateTransfer(SUBSTRATE_TRANSFER_ADDRESS);\n\n/// @title SubstrateTransfer interface\ninterface SubstrateTransfer {\n /// @dev Event emitted when a transfer has been performed.\n /// @param destination The Substrate address receiving the tokens.\n /// @param amount The amount of tokens transferred.\n event Transfer(bytes32 destination, uint256 amount);\n\n /// @dev Function to transfer tokens to a Substrate address.\n /// @param destination The Substrate address receiving the tokens.\n /// @param amount The amount of tokens to transfer.\n function transfer_substrate(bytes32 destination, uint256 amount) external;\n}",
"abi": "[{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"destination\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"destination\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transfer_substrate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]"
"source": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity >=0.8.3;\n\n/// @dev The Deposit precompile address\naddress constant SUBSTRATE_TRANSFER_ADDRESS = 0x0000000000000000000000000000000000000Fd1;\n\nSubstrateTransfer constant SUBSTRATE_TRANSFER_ADRRESS = SubstrateTransfer(SUBSTRATE_TRANSFER_ADDRESS);\n\n/// @title SubstrateTransfer interface\ninterface SubstrateTransfer {\n /// @dev Event emitted when a transfer has been performed.\n /// @param from Address which tokens are sent from.\n /// @param destination The Substrate address receiving the tokens.\n /// @param amount The amount of tokens transferred.\n event Transfer(address indexed from, bytes32 indexed destination, uint256 amount);\n\n /// @dev Function to transfer tokens to a Substrate address.\n /// @param destination The Substrate address receiving the tokens.\n /// @param amount The amount of tokens to transfer.\n function transfer_substrate(bytes32 destination, uint256 amount) external;\n}",
"abi": "[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"destination\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"destination\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transfer_substrate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]"
}
]
4 changes: 2 additions & 2 deletions precompiles/metadata/precompiles-creditcoin3-testnet.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"name": "SubstrateTransfer",
"bytecode": "0xfe",
"compiler": "Not Installed",
"source": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity >=0.8.3;\n\n/// @dev The Deposit precompile address\naddress constant SUBSTRATE_TRANSFER_ADDRESS = 0x0000000000000000000000000000000000000Fd1;\n\nSubstrateTransfer constant SUBSTRATE_TRANSFER_ADRRESS = SubstrateTransfer(SUBSTRATE_TRANSFER_ADDRESS);\n\n/// @title SubstrateTransfer interface\ninterface SubstrateTransfer {\n /// @dev Event emitted when a transfer has been performed.\n /// @param destination The Substrate address receiving the tokens.\n /// @param amount The amount of tokens transferred.\n event Transfer(bytes32 destination, uint256 amount);\n\n /// @dev Function to transfer tokens to a Substrate address.\n /// @param destination The Substrate address receiving the tokens.\n /// @param amount The amount of tokens to transfer.\n function transfer_substrate(bytes32 destination, uint256 amount) external;\n}",
"abi": "[{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"destination\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"destination\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transfer_substrate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]"
"source": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity >=0.8.3;\n\n/// @dev The Deposit precompile address\naddress constant SUBSTRATE_TRANSFER_ADDRESS = 0x0000000000000000000000000000000000000Fd1;\n\nSubstrateTransfer constant SUBSTRATE_TRANSFER_ADRRESS = SubstrateTransfer(SUBSTRATE_TRANSFER_ADDRESS);\n\n/// @title SubstrateTransfer interface\ninterface SubstrateTransfer {\n /// @dev Event emitted when a transfer has been performed.\n /// @param from Address which tokens are sent from.\n /// @param destination The Substrate address receiving the tokens.\n /// @param amount The amount of tokens transferred.\n event Transfer(address indexed from, bytes32 indexed destination, uint256 amount);\n\n /// @dev Function to transfer tokens to a Substrate address.\n /// @param destination The Substrate address receiving the tokens.\n /// @param amount The amount of tokens to transfer.\n function transfer_substrate(bytes32 destination, uint256 amount) external;\n}",
"abi": "[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"destination\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"destination\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transfer_substrate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]"
}
]
3 changes: 2 additions & 1 deletion precompiles/metadata/sol/substrate_transfer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ SubstrateTransfer constant SUBSTRATE_TRANSFER_ADRRESS = SubstrateTransfer(SUBSTR
/// @title SubstrateTransfer interface
interface SubstrateTransfer {
/// @dev Event emitted when a transfer has been performed.
/// @param from Address which tokens are sent from.
/// @param destination The Substrate address receiving the tokens.
/// @param amount The amount of tokens transferred.
event Transfer(bytes32 destination, uint256 amount);
event Transfer(address indexed from, bytes32 indexed destination, uint256 amount);

/// @dev Function to transfer tokens to a Substrate address.
/// @param destination The Substrate address receiving the tokens.
Expand Down
2 changes: 1 addition & 1 deletion precompiles/substrate-transfer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ mod mock;
mod tests;

/// Solidity selector of the Transfer log, which is the Keccak of the Log signature.
pub const SELECTOR_LOG_TRANSFER: [u8; 32] = keccak256!("Transfer(bytes32,uint256)");
pub const SELECTOR_LOG_TRANSFER: [u8; 32] = keccak256!("Transfer(address,bytes32,uint256)");

/// Alias for the Balance type for the provided Runtime and Instance.
pub type BalanceOf<Runtime, Instance = ()> =
Expand Down
Loading