From 34596c284143c60661bb6688d8dabe0fd4e07a58 Mon Sep 17 00:00:00 2001 From: Yaroslav Bolyukin Date: Fri, 14 May 2021 13:00:09 +0000 Subject: [PATCH] feat(eth): plain transfer for nft collections --- --- a/pallets/nft/src/eth/mod.rs +++ b/pallets/nft/src/eth/mod.rs @@ -125,6 +125,23 @@ ).map_err(|_| "transfer error")?; crate::abi_encode!(bool(true)) + } + // function transfer(address recipient, uint256 token) external returns (bool) { + 0xa9059cbb if erc721 => { + crate::abi_decode!(input, recipient: address, token_id: uint256); + let sender = T::CrossAccountId::from_eth(sender); + let recipient = T::CrossAccountId::from_eth(recipient); + let token_id: u32 = token_id.try_into().map_err(|_| "bad token id")?; + + >::transfer_internal( + &sender, + &recipient, + &collection, + token_id, + 1, + ).map_err(|_| "transfer error")?; + + crate::abi_encode!(bool(true)) } // function allowance(address owner, address spender) external view returns (uint256) 0xdd62ed3e if erc20 => { -- gitstuff