Skip to content

Commit

Permalink
Add mainnet configs
Browse files Browse the repository at this point in the history
  • Loading branch information
boczeratul committed Aug 21, 2024
1 parent 0990fd4 commit 6d07423
Show file tree
Hide file tree
Showing 7 changed files with 381 additions and 257 deletions.
3 changes: 0 additions & 3 deletions contracts/exchange/FlowSwapPair.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -509,9 +509,6 @@ contract FlowSwapPair: FungibleToken {

self.account.storage.save(<-vault, to: /storage/flowUsdtFspLpVault)

let admin <- create Administrator()
self.account.storage.save(<-admin, to: /storage/flowTokenAdmin)

// Setup internal FlowToken vault
self.token1Vault <- FlowToken.createEmptyVault(vaultType: Type<@FlowToken.Vault>())

Expand Down
19 changes: 7 additions & 12 deletions contracts/exchange/RevvFlowSwapPair.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ pub contract RevvFlowSwapPair: FungibleToken {
// created Vault to the context that called so it can be deposited
// elsewhere.
//
pub fun withdraw(amount: UFix64): @FungibleToken.Vault {
pub fun withdraw(amount: UFix64): @{FungibleToken.Vault} {
self.balance = self.balance - amount
emit TokensWithdrawn(amount: amount, from: self.owner?.address)
return <-create Vault(balance: amount)
Expand All @@ -97,7 +97,7 @@ pub contract RevvFlowSwapPair: FungibleToken {
// It is allowed to destroy the sent Vault because the Vault
// was a temporary holder of the tokens. The Vault's balance has
// been consumed and therefore can be destroyed.
pub fun deposit(from: @FungibleToken.Vault) {
pub fun deposit(from: @{FungibleToken.Vault}) {
let vault <- from as! @RevvFlowSwapPair.Vault
self.balance = self.balance + vault.balance
emit TokensDeposited(amount: vault.balance, to: self.owner?.address)
Expand All @@ -117,7 +117,7 @@ pub contract RevvFlowSwapPair: FungibleToken {
// and store the returned Vault in their storage in order to allow their
// account to be able to receive deposits of this token type.
//
pub fun createEmptyVault(): @FungibleToken.Vault {
pub fun createEmptyVault(): @{FungibleToken.Vault} {
return <-create Vault(balance: 0.0)
}

Expand All @@ -132,11 +132,11 @@ pub contract RevvFlowSwapPair: FungibleToken {
}

pub fun depositToken1(from: @REVV.Vault) {
self.token1.deposit(from: <- (from as! @FungibleToken.Vault))
self.token1.deposit(from: <- (from as! @{FungibleToken.Vault}))
}

pub fun depositToken2(from: @FlowToken.Vault) {
self.token2.deposit(from: <- (from as! @FungibleToken.Vault))
self.token2.deposit(from: <- (from as! @{FungibleToken.Vault}))
}

pub fun withdrawToken1(): @REVV.Vault {
Expand All @@ -150,11 +150,6 @@ pub contract RevvFlowSwapPair: FungibleToken {
vault <-> self.token2
return <- vault
}

destroy() {
destroy self.token1
destroy self.token2
}
}

// createEmptyBundle
Expand Down Expand Up @@ -313,7 +308,7 @@ pub contract RevvFlowSwapPair: FungibleToken {

assert(token2Amount > 0.0, message: "Exchanged amount too small")

self.token1Vault.deposit(from: <- (from as! @FungibleToken.Vault))
self.token1Vault.deposit(from: <- (from as! @{FungibleToken.Vault}))
emit Trade(token1Amount: token1Amount, token2Amount: token2Amount, side: 1)

return <- (self.token2Vault.withdraw(amount: token2Amount) as! @FlowToken.Vault)
Expand All @@ -333,7 +328,7 @@ pub contract RevvFlowSwapPair: FungibleToken {

assert(token1Amount > 0.0, message: "Exchanged amount too small")

self.token2Vault.deposit(from: <- (from as! @FungibleToken.Vault))
self.token2Vault.deposit(from: <- (from as! @{FungibleToken.Vault}))
emit Trade(token1Amount: token1Amount, token2Amount: token2Amount, side: 2)

return <- (self.token1Vault.withdraw(amount: token1Amount) as! @REVV.Vault)
Expand Down
2 changes: 1 addition & 1 deletion contracts/token/BloctoToken.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ contract BloctoToken: FungibleToken{
// account to be able to receive deposits of this token type.
//
access(all)
fun createEmptyVault(vaultType: Type): @{FungibleToken.Vault}{
fun createEmptyVault(vaultType: Type): @BloctoToken.Vault{
return <-create Vault(balance: 0.0)
}

Expand Down
Loading

0 comments on commit 6d07423

Please sign in to comment.