mirror of https://github.com/01-edu/public.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
jrosendo
7a960f7d00
|
2 years ago | |
---|---|---|
.. | ||
README.md | 2 years ago |
README.md
Basic Swap
We will create a basic swap smart contract that will allow two users, Alice and Bob, to exchange two minimal tokens safely. The contracts will be specific to the two users and unidirectional.
Instructions
- Create a
usableToken
contract as defined before - Create a Smart Contract
BasicSwap
with a constructor that takes the address of two Externally Owned Accounts. - Create a function
swap(tokenA, AmountA, TokenB, AmountB)
that takes as parameters, twoMinimalTokenAllowance
contracts and amounts- The function checks that users gave the corresponding allowances to the smart contract
- The function proceed to transfert the first amount in TokenA from Alice to Bob and the second amount from Bob to Alice
To test your smart contract, you will need to deploy two instances of MinimalTokenAllowance