New Contract Types Available on Stacks Testnet

November 29, 2022

New Contract Types Available on Stacks Testnet

Hello Stacks community! 

Today DLC.Link is happy to announce an upgrade to our Basic DLC management contract. Today’s deployment signifies the final beta release of our three contracts before the production launch. (To learn more about DLCs and DLC.Link, please visit our documentation site at https://docs.dlc.link)

Basic is the most generic version of our DLC management contract, and allows for arbitrary use cases to leverage DLCs. Any complex logic for the contract would be handled within the partner contract, and finally a payout of between 0 and 100 (5 digit precision) would be used to determine the payouts of the DLC.

DLC.Link has three types of contracts, which are used in different use-cases. In addition to the Basic contract, below is a description of the two other contracts, Priced and Loan. All contracts have an associated example usage contract showcasing a way to interface with the contract. They are each listed, along with a link to each contract.

For more information on each contract, please reference the associated README in Github, or view the contract on the explorer.

Basic

This is the most generic version of our DLC management contract, and allows for arbitrary use-cases to leverage DLCs. Any complex logic for the contract would be handled within the partner contract, and finally a payout of between 0 and 100 (5 digit precision) would be used to determine the payouts of the DLC.

Contract source: https://github.com/DLC-link/dlc-clarity-smart-contract/blob/master/contracts/dlc-manager.clar

Explorer: https://explorer.stacks.co/txid/ST12S2DB1PKRM1BJ1G5BQS0AB0QPKHRVHWXDBJ27R.dlc-manager-basic-v0-1?chain=testnet

Example contract source: https://github.com/DLC-link/dlc-clarity-smart-contract/blob/master/example/sample-protocol-contract.clar

Explorer: https://explorer.stacks.co/txid/ST3ZD9W0SMPF8D4HB1M155CCAGE1PB0FH7YZZ82KR.sample-contract-basic-v0-1?chain=testnet

Priced

This contract lets the associated application use oracle pricing data in their calculation of the DLC payout. For example, if your application lets users bet on the future price of BTC (or any other coin), you simply implement a function that uses this data to build the payout ratio, refer to it as a callback, and connect to the DLC.Link management contract. DLC.Link will fetch the pricing data, await for your contracts payout calculation, and then close the DLC accordingly.

By fetching the price of the associated asset used for this contract, we hope to abstract some complexity away from developers, leaving them more time to create great products with delightful user experiences.

Contract source: https://github.com/DLC-link/dlc-redstone-smart-contract/blob/main/contracts/dlc-manager-priced.clar

Explorer: https://explorer.stacks.co/txid/ST12S2DB1PKRM1BJ1G5BQS0AB0QPKHRVHWXDBJ27R.dlc-manager-priced-v0?chain=testnet

Example contract source: https://github.com/DLC-link/dlc-redstone-smart-contract/blob/main/example/sample-protocol-contract.clar

Explorer: https://explorer.stacks.co/txid/ST3ZD9W0SMPF8D4HB1M155CCAGE1PB0FH7YZZ82KR.sample-contract-priced-v0?chain=testnet

Loan

This contract makes it possible to open and close DLCs for a BTC-backed loan. It has built-in liquidation handling, and a way to calculate payout-curve points, which are then signed by our DLC Oracles. The current price of the underlying asset being used as collateral or loan will be fetched and used in calculation by the DLC.Link contract, removing that complexity from the developer.

Parameters you can pass in include the total loan amount, at what LTV (loan-to-value) ratio the liquidation should occur, an associated liquidation fee, etc.

With this contract we hope to abstract away much of the complexity of managing loan payouts away from developers, leaving them more time to create great products with delightful user experiences.

Contract source: https://github.com/DLC-link/dlc-stacks-loan-contract/blob/master/contracts/dlc-manager-loan.clar

Explorer: https://explorer.stacks.co/txid/ST12S2DB1PKRM1BJ1G5BQS0AB0QPKHRVHWXDBJ27R.dlc-manager-loan-v0?chain=testnet

Example contract source: https://github.com/DLC-link/dlc-stacks-loan-contract/blob/master/example/sample-protocol-contract.clar

Explorer: https://explorer.stacks.co/txid/ST3ZD9W0SMPF8D4HB1M155CCAGE1PB0FH7YZZ82KR.sample-contract-loan-v0?chain=testnet

Join us as we enable a Trillion dollars of Bitcoin capital to be used in smart contracts. Contact us:

Twitter | Discord | Website | Docs | GitHub | Email

arrow_back Back to Homepage

Related Articles