or
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up
Syntax | Example | Reference | |
---|---|---|---|
# Header | Header | 基本排版 | |
- Unordered List |
|
||
1. Ordered List |
|
||
- [ ] Todo List |
|
||
> Blockquote | Blockquote |
||
**Bold font** | Bold font | ||
*Italics font* | Italics font | ||
~~Strikethrough~~ | |||
19^th^ | 19th | ||
H~2~O | H2O | ||
++Inserted text++ | Inserted text | ||
==Marked text== | Marked text | ||
[link text](https:// "title") | Link | ||
![image alt](https:// "title") | Image | ||
`Code` | Code |
在筆記中貼入程式碼 | |
```javascript var i = 0; ``` |
|
||
:smile: | Emoji list | ||
{%youtube youtube_id %} | Externals | ||
$L^aT_eX$ | LaTeX | ||
:::info This is a alert area. ::: |
This is a alert area. |
On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?
Please give us some advice and help us improve HackMD.
Syncing
xxxxxxxxxx
Hack The Rainbow
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →Name of Project
NEARswap
We submit the project for the following prizes:
Gitcoin hackathon website.
Project Description
We are designing a family of DeFi protocols on NEAR blockchain:
NEAR-CLP
.NEARswap
is the first protocol from this family. It provides the following features:Here is a full description about NEARswap goals.
Here is the full project description.
Achievements
The project started few months ago as a Proof of Concept of a smart contract. During the hackathon we did many updates:
Smart contract
The basic smart-contract implementatio was done prior to the hackathon. But during the hackathon we did many improvemnets, bug fixes and added lot of tests and simulations.
Updated the smart contract
Created a proposal for Multi Token Standard, which outlines an alternative mechanism to
NEP21.transfer_from
. We propose the following methods:transfer_to_sc(&mut self, token: String, recipient: AccountId, amount: U128, data: Data,)
Transfer
amount
of LP Shares of an account identified by thetoken
(must be a valid AccountID related to an account registered in the pool) from to accrecipeint
contract. Implements the NEP-MFT interface.recipient
MUST be acc contract address. The recipient contract MUST implementMFTRecipient
interface.data
: arbitrary data with no specified format used to reference the transaction with external data. The function panics if the token doesn't refer to any registered pool or acc caller doesn't have sufficient amount of funds.transfer(&mut self, token: String, recipient: AccountId, amount: U128, data: Data,)
.Similar to
trasnfer_to_sc
. This function won't make any callback. Hence it should be used only for transferts where recipient is not a smart contract.token_url(&self, token: AccountId) -> String
Returns the number of decimals the token uses - e.g. 8, means to divide the token amount by 100000000 to get its user representation.
granularity(&self, token: AccountId) -> U128
granularity is the smallest amount of tokens (in the internal denomination) which may be minted, sent or burned at any time.
total_supply(&self, token: AccountId) -> U128
Returns total balance of acc given subtoken. Implements the NEP-MFT standard.
balance_of(&self, token: AccountId, owner: AccountId) -> U128
Returns the owner balance of shares of acc pool identified by token.
Created Mintable NEP21 tokens. Source code. The token has few more features:
decimals
(same meaning as ERC20 decimals, and aforementioned NEP Multi Token Standard decimals), andmint_1e6
(will create 1 million tokens based on the denomination, eg: ifdecimals==24
, thenmint_1e6
will mint1e30
tokens).We deployed the following tokens, each one has
decimals=24
. You can callnear call <token_address> mint_1e6 "{}" --accountId <my_account>
for each of these tokens:NEARswap CLI
Created a dedicated CLI: nearswap. Please check the project documentation. It's way more friendly to interact with
NEARswap
than thenear-cli
.NOTE:
neraswap
has issues withzsh
shell, becausezsh
parses{ .. }
(curly braces) for command parameters. Please usebash
.Example command using
near-cli
:Example command using
nearswap
:Rainbow Bridge demo
We setup our private bridge network and created UI for our custom tokens (more about it in the following section).
https://github.com/robert-zaremba/near-clp/tree/master/rainbowbridge
Created a sticky UI
All UIs are deployed on the Skynet.
NEARswap dapp -> Deployed on Skynet.
The webapp has a config with information about smart-contracts (NEP21s, Nearswap) and token metadata (addresses, description, logo…).
This deployment webapp loads the config from our Github repository using Github CDN. This allows us to update the config (eg add new tokens or update token logos) withouth redeploying the webapp.
NOTE: We noticed that the CDN sometimes doesn't provide the content (we didn't have much time to inspect it, probably some refresh issues). That's why we also privde the deployment with hardcoded config:
Fallback if the config is not loaded from the Github CDN (read the note above).
Tether bridge
Wrapped Eth bridge
NEARswap contract integration
Bridge integration PoC + wireframes
Project Team
Video
Link To Deployed Code
beta-1.nearswap.testnet
.You can also run the webapp by yourself:
Snippets from the demo:
Dear judge - you can create a GOLD pool yourself
We can continue a demo and create a GOLD pool. To do it you need to install and configure the nearswap-cli
NOTE: we invite you to crate the GOLD pool. It's visible in the UI. You can use it as soon as the GOLD pool will be created. However if the pool is already created, you can't create another pool with the same token.
Firstly we need to get some gold tokens. We create a NEP21 gold token, where everyone can mint some tokens. Let's firstly create some variables:
Now we need to mint some gold and create an allowance for the nearclp smart contract.
Now we can create a pool using our
nearswap
CLI: