-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement deposit/withdraw/redeem (minus contract calls). Add set_uma…
…_address/set_balancer_address/set_swaps_completed ajax calls. Assign price identifier (with model). Store abis as hidden fields, so that contracts can load the token contracts and approve transfers. Add :net_collateral_adjustment to uma_snapshot to enable deposit/withdraw/redeem. Add finalized flag to BalancerPool, and finalized button. Move UMA_COLLATERALIZATION from Pie model to initializer. Add implementations of blockchain token swap and balancer creation. Add amount_to_receive (for Uniswap exact in). Post processes in BalanceCalculator to adjust for Synthetic collateralization and extra ETH to aETH swap, if ETH is a crypto (since Balancer can only hold ERC-20 tokens). Add Utilities.current_timestamp, and fix the toHex method to return a valid Bytes32 (has to be 0x + 64 bytes).
- Loading branch information
1 parent
b6f7646
commit a52194c
Showing
23 changed files
with
631 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
function deposit_collateral(pie) { | ||
var amount = $('#amount').val(); | ||
|
||
if (amount > 0) { | ||
jQuery.ajax({url: '/pies/'+ pie + '/deposit_collateral.js', | ||
data: {'amount': amount}, | ||
type: "PUT", | ||
success: function(data) { update_graphics(JSON.parse(data)); }, | ||
error: function() { alert('Oh noes!'); }, | ||
async: false}); | ||
} | ||
else { | ||
alert("Please enter a valid amount"); | ||
} | ||
} | ||
|
||
function withdraw_collateral(pie) { | ||
var amount = $('#amount').val(); | ||
|
||
if (amount > 0) { | ||
jQuery.ajax({url: '/pies/'+ pie + '/withdraw_collateral.js', | ||
data: {'amount': amount}, | ||
type: "PUT", | ||
success: function(data) { update_graphics(JSON.parse(data)); }, | ||
error: function() { alert('You cannot withdraw so much that your collateralization falls below the minimum!'); }, | ||
async: false}); | ||
} | ||
else { | ||
alert("Please enter a valid amount"); | ||
} | ||
} | ||
|
||
function redeem_tokens(pie) { | ||
var amount = $('#amount').val(); | ||
|
||
if (amount > 0) { | ||
jQuery.ajax({url: '/pies/'+ pie + '/redeem_tokens.js', | ||
data: {'amount': amount}, | ||
type: "PUT", | ||
success: function(data) { update_graphics(JSON.parse(data)); }, | ||
error: function() { alert('Oh noes!'); }, | ||
async: false}); | ||
} | ||
else { | ||
alert("Please enter a valid amount"); | ||
} | ||
} | ||
|
||
function update_graphics(data) { | ||
$('#collateralization').text(data.collateralization); | ||
$('#collateral_progress').attr('class', data.progress_class + " progress-bar progress-bar-striped"); | ||
$('#adjustments').text(data.adjustments); | ||
$('#total_value').text(data.total_value); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.