Workers Auto Approve
Bug(s) Fix: Leveraged Positions Smart Contract Example
solidity, bug, smart, contract
The Leverage Facility Token example smart contract (contracts/examples/ConsumeDataExample/ levFacilityTokenExample.sol) was created to do the following (most of which works/there is semi-working code for):
1) Allow a person/organization to create a token with the initial price pegged to the price of a stock (in the example Alibaba, but could be any that OrFeed currently supports). The creator/owner has to over-collateralize because the token contract also serves as a facility for people to place opinionated (long or short) bets and add leverage (1x to 10x). Additionally, anyone can mint tokens by overcollaterlizing. The creators and minters get rewards when people close positions that go against a trader, and lose funds when positions go for traders. The idea being, with a small fee, that given the random walk theory of markets, the house (creators/owner) always win because 1) odds are slightly in their favor if you add fees (even with 50/50), and 2) traders keep trading and eventually lose their money... it's just the nature of the universe... and ... er gambling.
2) Allow participants (anyone) to open positions with leverage (both long and short), with the token creator and facility token minters' collateral being the counterparty funds for a trade
3) When a user closes a position that goes in their favor (their leverage is calculated and collateral funds are sent to the user). When the user closes the position that goes against their favor (part or all of their funds are added into the collateral pool, a percentage of which can be pulled out by the minters/owner as reward for collateralizing an acting as a counter-party).
4) When there is not enough collateral from minters/owner to pay a position reward, what can be afforded to be paid is paid out, while collateralization is maintained so that other participants that are in positions can withdraw their funds... in this case, the owner/minters would only be able to get up to 25% or so of their funds back).
5) Throughout this whole flow the actual tokens/not positions are tradable on uniswap etc. Ideally we would integrate the code from the same directory so when token is launched it automatically launches a Uniswap market as well.
Much of the base code is there but some of the functionality is not working/math is a bit janky. First big step we need to achieve is to lay out all the things that are not working or could work better. Please leave comments/ideas if you intend to contribute (and much thanks by the way), and we can collaborate ourselves towards a capital efficient (leverage), opinionated (long and short) future!
Setup your profile
Tell us a little about you:
No results found for
Type to search skills..
Required [[totalcharacter]] / 240
Are you currently looking for work?
[[ option.string ]]
Setup your profile
Our tools are based on the principles of earn (💰), learn (📖), and meet (💬).
Select the ones you are interested in. You can change it later in your settings.
I'm also an organization manager looking for a great community.
Enable your organization profile
Gitcoin products can help grow community around your brand. Create your tribe, events, and incentivize your community with bounties. Announce new and upcoming events using townsquare. Find top-quality hackers and fund them to work with you on a grant.
These are the organizations you own. If you don't see your organization here please be sure that information is public on your GitHub profile. Gitcoin will sync this information for you.
Select the products you are interested in:
Out of the box you will receive Tribes Lite for your organization. Please provide us with a contact email: