-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement simple bond contract + add details to bond section of technical spec #4
Comments
can we fork someone else's bond contract / dao to jumpstart our own? here's some examples i found 🤔 BarnBridge even has a whole frontend we can use, that includes governance among a ton of other super cool features https://github.com/BarnBridge/barnbridge-frontend i gave it a local run and it looks cool too |
Found another one that looks promising |
I'm not sure how we would - our bond is a zero coupon bond without interest rates. SmartBond seems to be a bond that pays interest. Barnbridge seems significantly more complex than we need.
We'd want to inherit from open zepplin ERC20 token More info about our bond token: |
We will be forking gnosis auction for DAOs to perform the debt auction and sell their debt. After an auction is cleared - we will need to deploy a new bond contract and send the bond tokens to the investors who had winning bids |
this one looks cool https://github.com/SamuelSchlesinger/erc20-bond |
this is a little confusing, our bond spec sheet shows several mentions of an interest rate
so can people specify the interest rate they want on a bond or no? since it's imputed interest, shouldn't they only be allowed to bid on a bond's price? the par value will always be the same, and the interest rate will automatically calculate between bond price <> face value <> maturity date
does this sound right? |
The original plan was to have actual interest payment but was changed - so language might be a bit confusing there. The plan for v1 is only zero coupon bonds.
exactly.
No - it's based on the bond price and calculated automatically. It may be displayed to the user though to help them decide which price to bid - that'd be calculated on the frontend though.
Price will be the settlement price from the batch auction - (info would be supplied by auction)
Face value per bond will always be $1
Exactly. Calculated by
This would be supplied by the bond issuer |
so are we having 1 contract (ie, a published & deployed address) per $1 bond? if someone auctions for $2000, they are purchasing 2000 bonds, thus 2000 addresses to deploy on mainnet? or will 1 contract hold multiple "bonds", ie the ending bond value of $2000? the $1 par value is confusing me on how to architect this. here's what I had but now the // Bond.sol
constructor(
// Name of this contract
string _name,
// The borrowed token address this bond is holding
address _borrowedToken,
// Desired borrow amount
uint256 _borrowAmount,
// Where to withdraw funds from to pay out the bond
address _treasury,
// Who to deposit funds to pay out the bond
address _winner,
// Amount of time until bond matures
uint256 _termLength,
// Amount and type of collateral securing debt
address _collateralToken,
uint256 _collateralAmount,
/*
* -- Convertibility --
* Whether or not the bond will be redeemable for the collateral provided.
*
* Convertibility gives bond holders the option to redeem their bond for a prorated
* share of the collateral provided at any time. This provides bond holders a call
* option on the asset in the collateral contract with the breakeven price being determined
* by the amount of the collateral and the price of the bond with respect to the collateral asset.
*/
bool _convertable,
// Total value at maturity
uint256 _yield |
One bond contract would have X number of bonds that have a maturity of $1. (Each token is a bond)
This is correct. You can imagine that an auction ends with a clearing price of 80 cents per bond, with 2000 bonds sold. 2000 bonds would need to be minted and distributed to the winning bidders. It may be worth learning on how gnosis auction works if you are not already familiar. The winning bidders will be receiving these bond tokens as the Code meta feedback:I think we should follow NatSpec for comments. Aave Example Code feedback:
|
@luckyrobot can you look into about how much gas it takes to deploy the bond contract you are working on? We will likely be deploying a new bond contract for each auction - so it'd be good to know how much gas is needed for that so we can estimate price. I'm a bit confused about how much it'd cost as this stack overflow post says 3m gas but https://soliditydeveloper.com/clonefactory shows 212k gas |
can do. i can either have tests for it first to calculate gas, or i'd have to build the whole contract and deploy in testnet to see gas (correct me if im wrong) |
I'm not sure - I think Maybe https://hardhat.org/hardhat-network/reference/#eth-estimategas?
That's just running |
right, but since the contract isn't finished, the gas wouldn't be accurate yet |
That's true but I'm moreso looking for a very rough estimate vs exact amount |
https://ropsten.etherscan.io/tx/0x387efb77e56e0b3f6066c8a853464c9a4b1b24ffbf0d49a0063793168f058638 2,271,956 gas to deploy current bond contract ... https://ropsten.etherscan.io/tx/0xc164917ff5f918aec456e8d9912bd40ea9fc2715a69177093b421a93c6d2c498 @ 100 gwei So ~ .2eth ($500) to deploy a bond contract - yikes! |
I wonder if we could use https://github.com/optionality/clone-factory |
clone factory looks dope, do you know how much gas it would save? |
Not sure - I made #15 to explore that question + alternatives. Once you finish up the 2 bond PRs can you look into it? |
* update bond methods * remove commetned out code * Apply suggestions from code review Co-authored-by: Kyle <[email protected]> * address comments * burnfrom instead * set maturity date from constructor * pr fixes * remove user * apply bond standing * apply bond standing * shorter require msg * fix tests * (pr fix) variable renames Co-authored-by: bookland <bookland.porter.finance> Co-authored-by: luckyrobot <[email protected]> Co-authored-by: Kyle <[email protected]>
Current info about bondtoken here - #1
It may help if we start with the simplest design - no factories - no convertibility - no upgradability -imagine we want to create just a simple bond token.
The text was updated successfully, but these errors were encountered: