AthanorLabs / atomic-swap

💫 ETH-XMR atomic swap implementation
GNU Lesser General Public License v3.0
341 stars 44 forks source link

⚡ Solidity Improvements #420

Open 0xClandestine opened 1 year ago

0xClandestine commented 1 year ago

Hey guys, been watching the project unfold for months and have learned a lot. As a way to give back I thought I'd contribute some improvements for the smart contracts. Since I'm a first time contributor I feel its probably best to start with an issue outlining some of my improvements.

Improvement 1 ⛽

Reasoning:

Improvement 2 ⛽

Reasoning:

function computeSwapIdentifier(Swap memory swap) 
    internal 
    pure 
    returns (bytes32) 
{
    return keccak256(
        abi.encodePacked(
            swap.pubKeyClaim,
            swap.pubKeyRefund,
            swap.owner,
            swap.claimer,
            swap.asset,
            swap.value,
            swap.timeout0,
            swap.timeout1,
            swap.nonce
        )
    );
}
0xClandestine commented 1 year ago

There's more improvements to come, just pushing what I had time to document last night.

noot commented 1 year ago

@0xClandestine hey, thanks for these suggestions! let us know if you plan to open a PR with these changes, otherwise I can add these in. if you have any contributing questions feel free to ask :)

0xClandestine commented 1 year ago

@noot Would be glad to make a PR, will shoot for this weekend.