Skip to content
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

refactor: adding pool logic #3

Merged
merged 19 commits into from
Oct 28, 2024
Merged

refactor: adding pool logic #3

merged 19 commits into from
Oct 28, 2024

Conversation

kupermind
Copy link
Collaborator

  • Adding pool logic.

@@ -13,10 +38,38 @@ interface IERC20 {
function approve(address spender, uint256 amount) external returns (bool);
}

interface IOracle {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oracle for the ETH-USDC pair.

@@ -27,6 +80,12 @@ interface IRollupBridge {
* The remainder of the ETH contributed (90%) is converted to USDC and contributed to an LP, together with 50% of the token supply of the meme.
*/
contract MemeBase {
event OLASBridgedForBurn(address indexed olas, uint256 amount);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just moved around

contracts/MemeBase.sol Outdated Show resolved Hide resolved
contracts/MemeBase.sol Outdated Show resolved Hide resolved
event Hearted(address indexed user, uint256 amount);
event Unleashed(address indexed memeToken, address indexed lpPairAddress);
event Purged(address indexed memeToken, uint256 remainingAmount);
address[] public memeTokens;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's track all the created tokens

@@ -121,7 +197,7 @@ contract MemeBase {
emit Hearted(msg.sender, msg.value);
}

function unleashThisMeme(address memeToken) external {
function unleashThisMeme(address memeToken, uint256 olasSpotPrice) external {
Copy link
Collaborator Author

@kupermind kupermind Oct 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The olasSpotPrice is calculated by the balancer SDK

This is good for the price manipulation protection, and it also means that most likely this call will be made by the agent, because one needs to calculate the spot price.

bytes memory data = abi.encodeWithSignature("burn(uint256)", OLASAmount);

// Bridge OLAS to mainnet
IRollupBridge(rollupBridge).bridgeTokens(olas, OLASAmount, data);
// Bridge OLAS to mainnet to get burned
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this correct? What we want is that upon arrival on mainnet, "burn" gets called on OLAS

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed now, we'll have to add a bit more to that. There's no way to have a callback associated with the encoded data, it just stays there for the record in the emit. So we can have a dedicated Burn contract on ETH mainnet side, or send it all to Timelock, and then have a proposal to burn that amount identified by that bridge burn function call.

@DavidMinarsch DavidMinarsch merged commit 5484fa1 into main Oct 28, 2024
4 of 6 checks passed
@DavidMinarsch DavidMinarsch deleted the pools branch October 28, 2024 03:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants