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

feat(nft-swap): add standalone maker contract and proxy support #2100

Merged
merged 49 commits into from
Jul 18, 2024
Merged
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
394fe4d
use NFT_MAKER_SWAP_V2 in nft_swap_v2 mod and in spend erc721 test
laruh Apr 18, 2024
44f542d
deploy contracts before tokens, add constructor to EtomicSwapMakerNft…
laruh Apr 18, 2024
ff1006a
use Sepolia in dockerized nft tests
laruh Apr 22, 2024
aebf756
global variables and send nft back to maker
laruh Apr 23, 2024
1966fcf
add web3 HTTPS support in mm2_main tests
laruh Apr 23, 2024
1922bff
wait for send_back_tx confirmation
laruh Apr 23, 2024
c07e8e2
call contract addresses with functions
laruh Apr 23, 2024
ebac6e6
impl check_token_uri and make chains field in ClearNftDbReq optional …
laruh Apr 4, 2024
f9f4eab
doc comms
laruh Apr 24, 2024
ad0ce31
Merge remote-tracking branch 'origin/dev' into standalone-nft-maker-s…
laruh Apr 25, 2024
4a4dfc0
Merge remote-tracking branch 'refs/remotes/origin/dev' into standalon…
laruh Apr 26, 2024
c703913
fix merge conflicts
laruh Apr 26, 2024
fe498fa
impl wait_pending_transactions
laruh Apr 26, 2024
18fa53e
increase max nonce by 1
laruh Apr 26, 2024
b9a6719
Revert "increase max nonce by 1"
laruh Apr 26, 2024
9a23f20
Merge remote-tracking branch 'origin/dev' into standalone-nft-maker-s…
laruh Apr 29, 2024
998708b
impl get_or_create_nft function
laruh Apr 29, 2024
364d795
additional logs, ignore erc1155
laruh Apr 29, 2024
cb187c7
deploy new SEPOLIA_ERC721_CONTRACT
laruh Apr 29, 2024
9d4e3ee
fix linter
laruh Apr 29, 2024
495e7a9
run both nft send payment tests
laruh Apr 29, 2024
e917b0b
proxy: send nft reqs with payload data in body to satisfy proxy HttpG…
laruh May 6, 2024
f868a50
Merge remote-tracking branch 'refs/remotes/origin/dev' into standalon…
laruh May 8, 2024
e94fac7
provide UrlSignWrapper structure
laruh May 9, 2024
2e8c662
additionally include chain field into UrlSignWrapper
laruh May 9, 2024
0fbf75d
increase erc721 tx confirmation time to 150, add more logs
laruh May 9, 2024
03860e1
review: use map_err for generate_gui_auth_signed_validation, doc comm…
laruh May 10, 2024
b8b05d1
proxy: send regular http post request to proxy for nft feature
laruh May 12, 2024
3de2b92
make erc721 and erc1155 time locks different in tests
laruh May 12, 2024
f2625fd
Merge remote-tracking branch 'refs/remotes/origin/dev' into standalon…
laruh May 13, 2024
930a593
Merge remote-tracking branch 'refs/remotes/origin/dev' into standalon…
laruh May 14, 2024
350abd6
review: impl lock_coins() to keep coins field in CoinsContext private
laruh May 14, 2024
36eaf38
review: rename Gui-Auth types to align with new names in the KomodoDe…
laruh May 15, 2024
4478ccb
review: use "http-rustls-tls" feature in web3 crate for tests
laruh May 15, 2024
7882e6e
review: send Http GET request to activate NFT
laruh May 16, 2024
d03b6d1
review: support GET requests to KomodoDeFi Proxy layer and to 3rd API…
laruh May 17, 2024
ff92a20
impl build_and_send_request func to avoid code repetition
laruh May 17, 2024
a2c47f8
review: panic in wait_for_geth_node_ready if Deth node is not ready a…
laruh May 17, 2024
d6cbfd8
Merge remote-tracking branch 'refs/remotes/origin/dev' into standalon…
laruh May 21, 2024
9c3ff07
merge: fmt, log tx_hash() in NFT payments instead of bytes, import et…
laruh May 21, 2024
0bedba3
send only signed message as header in nft
laruh May 23, 2024
7976761
Merge remote-tracking branch 'refs/remotes/origin/dev' into standalon…
laruh May 24, 2024
5f34f1c
Merge remote-tracking branch 'refs/remotes/origin/dev' into standalon…
laruh Jun 22, 2024
e672485
review: provide log!, instead println! in tests
laruh Jun 22, 2024
0d54567
Merge remote-tracking branch 'refs/remotes/origin/dev' into standalon…
laruh Jun 28, 2024
801a688
Merge remote-tracking branch 'refs/remotes/origin/dev' into standalon…
laruh Jul 8, 2024
1e050d2
fmt code after merge
laruh Jul 8, 2024
7cbb941
Merge remote-tracking branch 'refs/remotes/origin/dev' into standalon…
laruh Jul 10, 2024
191b5f0
Merge remote-tracking branch 'origin/dev' into standalone-nft-maker-s…
laruh Jul 18, 2024
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
141 changes: 122 additions & 19 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 6 additions & 4 deletions mm2src/coins/eth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ use crypto::{Bip44Chain, CryptoCtx, CryptoCtxError, GlobalHDAccountArc, KeyPairP
use derive_more::Display;
use enum_derives::EnumFromStringify;
use ethabi::{Contract, Function, Token};
pub use ethcore_transaction::SignedTransaction as SignedEthTx;
use ethcore_transaction::{Action, Transaction as UnSignedEthTx, UnverifiedTransaction};
pub use ethcore_transaction::{Action, SignedTransaction as SignedEthTx};
use ethcore_transaction::{Transaction as UnSignedEthTx, UnverifiedTransaction};
use ethereum_types::{Address, H160, H256, U256};
use ethkey::{public_to_address, sign, verify_address, KeyPair, Public, Signature};
use futures::compat::Future01CompatExt;
Expand Down Expand Up @@ -145,6 +145,7 @@ const ERC721_ABI: &str = include_str!("eth/erc721_abi.json");
/// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1155.md
const ERC1155_ABI: &str = include_str!("eth/erc1155_abi.json");
const NFT_SWAP_CONTRACT_ABI: &str = include_str!("eth/nft_swap_contract_abi.json");
const NFT_MAKER_SWAP_V2_ABI: &str = include_str!("eth/nft_maker_swap_v2_abi.json");

/// Payment states from etomic swap smart contract: https://github.com/artemii235/etomic-swap/blob/master/contracts/EtomicSwap.sol#L5
pub enum PaymentState {
Expand Down Expand Up @@ -207,6 +208,7 @@ lazy_static! {
pub static ref ERC721_CONTRACT: Contract = Contract::load(ERC721_ABI.as_bytes()).unwrap();
pub static ref ERC1155_CONTRACT: Contract = Contract::load(ERC1155_ABI.as_bytes()).unwrap();
pub static ref NFT_SWAP_CONTRACT: Contract = Contract::load(NFT_SWAP_CONTRACT_ABI.as_bytes()).unwrap();
pub static ref NFT_MAKER_SWAP_V2: Contract = Contract::load(NFT_MAKER_SWAP_V2_ABI.as_bytes()).unwrap();
}

pub type GasStationResult = Result<GasStationData, MmError<GasStationReqErr>>;
Expand Down Expand Up @@ -464,7 +466,7 @@ impl From<PrivKeyBuildPolicy> for EthPrivKeyBuildPolicy {
pub struct EthCoinImpl {
ticker: String,
pub coin_type: EthCoinType,
priv_key_policy: EthPrivKeyPolicy,
pub(crate) priv_key_policy: EthPrivKeyPolicy,
/// Either an Iguana address or a 'EthHDWallet' instance.
/// Arc is used to use the same hd wallet from platform coin if we need to.
/// This allows the reuse of the same derived accounts/addresses of the
Expand Down Expand Up @@ -3356,7 +3358,7 @@ impl EthCoin {

#[cfg_attr(test, mockable)]
impl EthCoin {
pub(crate) fn sign_and_send_transaction(&self, value: U256, action: Action, data: Vec<u8>, gas: U256) -> EthTxFut {
pub fn sign_and_send_transaction(&self, value: U256, action: Action, data: Vec<u8>, gas: U256) -> EthTxFut {
let coin = self.clone();
let fut = async move {
match coin.priv_key_policy {
Expand Down
Loading
Loading