Learning Goal: I’m working on a economics practice test / quiz and need a sample draft to help me learn.
Individual Coursework
The individual course work consists of 3 parts
Smart contract for marketplaces in DAML (20 points)
Bitcoin Testnet Transaction (15 points)
Interacting with Uniswap (65 points)
Deliverables
Upload one PDF file that includes the following information:
Complete Python code (BTC transactions) and smart contract code (DAML and Solidity);
Screenshots of the transaction submitted on the BTC testnet;
Answers and explanations requested below.
Smart contract for marketplaces in DAML
In this exercise you have to build in a smart contract template in DAML that can be used for
decentralized marketplaces. To do this, you are asked to create a new contract template
called Itemtosell that the seller can use to advertise a certain item and transfer
ownership to a buyer . We also wish to add an insurer that can only view the information
about the trade (without being able to issue or modify the contract Itemtosell ).
Contract template
1. Start by creating a new project and .daml file.
2. Create a contract template called Itemtosell (3 points). In the contract you must
specify the following:
Seller
Owner
Insurer
Type of item
Quantity
Price
Currency3. Then, define the roles of the parties. What type of party should the seller be? And the
insurer? (2 points)
4. Add a function ChangePrice to modify the price listed in the contract where the
controller is the “owner” of the item. (2 points)
5. Add a function Sell that modifies the owner of the item listed in the contract where
the controller is the “owner” of the item. (2 points)
Scenario testing
In the scenario testing part, using the following structure
test = Script()
test = script do
— Add parties
— Create contract
— Transfer ownership
return()
you must:
1. Create three parties: “Party 1” (the seller), “Party 2” (the buyer), “Party 3” (the insurer). (3
points)
2. Let the seller “Party 1” issue a new contract where the seller “Party 1” wishes to sell 1
painting for 1000 GBP to “Party 2”. At this stage set the owner = the seller (2 points)
3. Let the owner (=seller) of the painting transfer the ownership to “Party 2” (the buyer).
(2 points)
4. Take a screenshot of the state of the ledger (by looking at the scenario results). (2
points)
5. Describe one example where the execution of the contract would fail automatically and
explain why this would happen. (2 points)
Bitcoin Testnet Transaction
Use the Python code developed in the lab practical session.1. Create 4 Bitcoin Testnet addresses. Add below the addresses and the corresponding
secrets, namely address1, address2, address3, address4. (2 points)
2. From a BTC testnet faucet (e.g., https://bitcoinfaucet.uo1.net) send >5000 Satoshis to
one of the addresses. (1 point)
3. Create a 1-input 3-outputs transactions transferring 50%, 30%, 15% of the amount
respectively into address2, address3, address4 respectively. (5 points)
4. Sign the transaction and submit it into the Bitcoin testnet via
https://live.blockcypher.com/btc/pushtx/ (5 points)
5. How much fees are transferred to the miner and how are they calculated? (2 points)
Interacting with Uniswap
Your submission should include answers to the following questions.
You are recommended to read through all the questions first before you start to attempt.
1. Create a token with the following configuration using LuckyTokenSkeleton.sol on
Remix:
name: LuckyCoin{your_initials}
symbol: LC{your_initials} (for simplification, we call it LC below)
decimals: 18 Note: please make sure to read carefully the in-line comments and
block comments in LuckyTokenSkeleton.sol which contain further, more detailed
instructions on how to complete the contract. Also, read through the entire script
to understand the structure of the code first before starting to attempt.
i. What is the contract code? (10 points)
2. Test the contract by deploying it on a Remix VM and interacting with the contract.
Include in your test at least the following steps:
mint 2 LC to some address X
[… some intermediary steps in between …]
use some other address Y to call transferFrom to transfer 0.48 LC from address
X to some 3rd address Z
i. Share a screenshot where you call balanceOf of address Z on Remix immediately
after the transferFrom step described above. (5 points)
3. Choose an EVM-testnet where Uniswap V3 and ChainLink are deployed. Tap enough
native coins (e.g. ETH for Goerli, MATIC for Polygon Mumbai) to be used to pay gas as
well some LINK .i. What is the test network that you choose?
ii. How did you obtain coins and tokens on this test network? (2 points)
4. Specify an account address that will be used to sign transactions on the chosen testnet
in this assignment (let’s call it address A below).
i. What’s the address? (1 point)
5. Deploy token LC onto the test network from address A.
i. What is the token smart contract address?
ii. What is the transaction hash?
iii. Verify and Publish your contract source code. Share the code URL, e.g.
https://mumbai.polygonscan.com/address/0x326c977e6…
60ed06fb#code (10 points)
6. Create a liquidity pool with LINK and LC with the following configuration (slight
numerical deviations enforced by the UI/UX can be tolerated). You can do so by directly
interacting with the web interface of Uniswap:
fee tier: 0.3%
Current price: 500 LC / LINK
Min price: 400 LC / LINK
Max price: 600 LC / LINK
Deposit amount: 0.5 LINK
i. What is the amount of LC that needs to be deposited?
ii. What is the pool URL?
iii. What is the pool smart contract address? (3 points)
7. Try to buy 0.1 LINK with LC without confirming the transaction.
i. What is the amount of LC expected to be paid?
ii. What is the maximum sent after slippage?
iii. What is the price impact? Note: in the rare case when Uniswap UI malfunctions
and you cannot locate the tokens in the swap interface, you can manually type
your tokens’ addresses in the URL as in https://app.uniswap.org/#/swap?
outputCurrency=0x4BF3027C28Ca9001c6EF9700571922f3c2A0E854&inputCurrenc
y=0x326C977E6efc84E512bB9C30f76E30c160eD06FB (3 points)
8. Buy 0.05 LINK with LC with slippage tolerance of 1.2%.
i. What does the app warn you with this slippage setting?ii. Briefly interpret the warning message.
iii. What is the amount of LC to be paid?
iv. What is the liquidity provider fee?
v. What is the price impact?
vi. What is the transaction hash?
vii. What is the current price of LINK denominated in LC after the transaction? (7
points)
9. Sell 0.05 LINK for LC with slippage tolerance of 0.02%.
i. What does the app warn you with this slippage setting?
ii. Briefly interpret the warning message.
iii. What is the amount of LC to be received?
iv. What is the liquidity provider fee?
v. What is the price impact?
vi. What is the transaction hash?
vii. What is the current price of LINK denominated in LC after the transaction? (7
points)
10. Collect all the fees.
i. How many fees are there?
ii. What is the transaction hash? (2 points)
11. Add more liquidity to the pool with 0.1 LINK .
i. What is the amount of LC to be added?
ii. What is the transaction hash? (2 points)
12. Remove 25% of the liquidity from the pool.
i. What is the respective amount of LC and ETH to be removed?
ii. What is the transaction hash?
iii. What is the current price of LINK denominated in LC after the transaction? (3
points)
13. Based on the experiment above and your own understanding of Uniswap mechanism
as well as AMM-based DEX in general, briefly generalize the relationships between spot
price, liquidity depth, slippage tolerance, exchange volume, price impact and liquidity
provider fee. (10 points)
Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.
You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.
Read moreEach paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.
Read moreThanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.
Read moreYour email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.
Read moreBy sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.
Read more
Recent Comments