Skip to content

Commit

Permalink
Merge branch 'forge-docs' of https://github.com/KlimaDAO/klimadao-sol…
Browse files Browse the repository at this point in the history
…idity into forge-docs
  • Loading branch information
ChazSchmidt committed Jan 23, 2024
2 parents 62c9d71 + 524e654 commit 8a1f1da
Show file tree
Hide file tree
Showing 38 changed files with 2,714 additions and 375 deletions.
3 changes: 2 additions & 1 deletion .env.template
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ DAO_MSIG=0x65A5076C0BA74e5f3e069995dc3DAB9D197d995c
POLICY_MSIG=0xD2f4A710b7dB5C0A05f17b68Fd5dA3C4c6b63be1

INFINITY_ADDRESS=0x8cE54d9625371fb2a068986d32C85De8E6e995f8
RETIREMENT_V1_ADDRESS=0xEde3bd57a04960E6469B70B4863cE1c9d9363Cb8

## Testing Environment Variables

Expand All @@ -23,4 +24,4 @@ MCO2_QUICKSWAP=0x64a3b8cA5A7e406A78e660AE10c7563D9153a739
SUSHI_BCT_LP=0x9803c7aE526049210a1725F7487AF26fE2c24614
SUSHI_NCT_LP=0xb2D0D5C86d933b0aceFE9B95bEC160d514d152E1
TRIDENT_UBO_LP=0x5400A05B8B45EaF9105315B4F2e31F806AB706dE
TRIDENT_NBO_LP=0x251cA6A70cbd93Ccd7039B6b708D4cb9683c266C
TRIDENT_NBO_LP=0x251cA6A70cbd93Ccd7039B6b708D4cb9683c266C
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,5 @@ node_modules
.cache
.local
.DS_Store

docs/
218 changes: 218 additions & 0 deletions abi/KlimaInfinity.json
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,60 @@
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "projectToken",
"type": "address"
},
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
},
{
"internalType": "string",
"name": "retiringEntityString",
"type": "string"
},
{
"internalType": "address",
"name": "beneficiaryAddress",
"type": "address"
},
{
"internalType": "string",
"name": "beneficiaryString",
"type": "string"
},
{
"internalType": "string",
"name": "retirementMessage",
"type": "string"
},
{
"internalType": "enum LibTransfer.From",
"name": "fromMode",
"type": "uint8"
}
],
"name": "icrRetireExactCarbon",
"outputs": [
{
"internalType": "uint256",
"name": "retirementIndex",
"type": "uint256"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
Expand Down Expand Up @@ -626,6 +680,84 @@
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "operator",
"type": "address"
},
{
"internalType": "address",
"name": "from",
"type": "address"
},
{
"internalType": "uint256[]",
"name": "ids",
"type": "uint256[]"
},
{
"internalType": "uint256[]",
"name": "values",
"type": "uint256[]"
},
{
"internalType": "bytes",
"name": "data",
"type": "bytes"
}
],
"name": "onERC1155BatchReceived",
"outputs": [
{
"internalType": "bytes4",
"name": "",
"type": "bytes4"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "operator",
"type": "address"
},
{
"internalType": "address",
"name": "from",
"type": "address"
},
{
"internalType": "uint256",
"name": "id",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "value",
"type": "uint256"
},
{
"internalType": "bytes",
"name": "data",
"type": "bytes"
}
],
"name": "onERC1155Received",
"outputs": [
{
"internalType": "bytes4",
"name": "",
"type": "bytes4"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
Expand Down Expand Up @@ -911,6 +1043,92 @@
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [
{
"components": [
{
"internalType": "bytes32",
"name": "id",
"type": "bytes32"
},
{
"internalType": "address",
"name": "account",
"type": "address"
},
{
"internalType": "address",
"name": "token",
"type": "address"
},
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "remainingAmount",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "unitPrice",
"type": "uint256"
}
],
"internalType": "struct ICarbonmark.CreditListing",
"name": "listing",
"type": "tuple"
},
{
"internalType": "uint256",
"name": "maxAmountIn",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "retireAmount",
"type": "uint256"
},
{
"internalType": "string",
"name": "retiringEntityString",
"type": "string"
},
{
"internalType": "address",
"name": "beneficiaryAddress",
"type": "address"
},
{
"internalType": "string",
"name": "beneficiaryString",
"type": "string"
},
{
"internalType": "string",
"name": "retirementMessage",
"type": "string"
},
{
"internalType": "enum LibTransfer.From",
"name": "fromMode",
"type": "uint8"
}
],
"name": "retireCarbonmarkListing",
"outputs": [
{
"internalType": "uint256",
"name": "retirementIndex",
"type": "uint256"
}
],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [
{
Expand Down
2 changes: 1 addition & 1 deletion foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ match_test = "testSim"
fuzz = { runs = 5_000, max_test_rejects = 1000000 }

[fmt]
int_types = "short"
int_types = "long"
line_length = 120
number_underscore = "thousands"
override_spacing = false
Expand Down
72 changes: 19 additions & 53 deletions script/upgradeInfinity.s.sol
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

/******************************************************************************\
* Authors: Cujo <[email protected]>
* EIP-2535 Diamonds: https://eips.ethereum.org/EIPS/eip-2535
* Script to upgrade Infinity diamond with new and revised facets
/******************************************************************************/
/**
* \
* Authors: Cujo <[email protected]>
* EIP-2535 Diamonds: https://eips.ethereum.org/EIPS/eip-2535
*
* Script to upgrade Infinity diamond with new and revised facets
* /*****************************************************************************
*/

import "forge-std/Script.sol";
import "../src/infinity/interfaces/IDiamondCut.sol";
Expand All @@ -22,6 +24,8 @@ import {RetireCarbonFacet} from "../src/infinity/facets/Retire/RetireCarbonFacet
import {RetireInfoFacet} from "../src/infinity/facets/Retire/RetireInfoFacet.sol";
import {RetireSourceFacet} from "../src/infinity/facets/Retire/RetireSourceFacet.sol";
import {RetirementQuoter} from "../src/infinity/facets/RetirementQuoter.sol";
import {ERC1155ReceiverFacet} from "src/infinity/facets/ERC1155ReceiverFacet.sol";
import {RetireICRFacet} from "src/infinity/facets/Bridges/ICR/RetireICRFacet.sol";
import {DiamondInit} from "../src/infinity/init/DiamondInit.sol";
import "../test/infinity/HelperContract.sol";

Expand All @@ -41,65 +45,27 @@ contract DeployInfinityScript is Script, HelperContract {
RetireCarbonFacet retireCarbonF = new RetireCarbonFacet();
RetireSourceFacet retireSourceF = new RetireSourceFacet();
RetirementQuoter retirementQuoterF = new RetirementQuoter();
RetireICRFacet retireICRF = new RetireICRFacet();
ERC1155ReceiverFacet erc1155ReceiverF = new ERC1155ReceiverFacet();

// FacetCut array which contains the three standard facets to be added
IDiamondCut.FacetCut[] memory cut = new IDiamondCut.FacetCut[](7);
IDiamondCut.FacetCut[] memory cut = new IDiamondCut.FacetCut[](2);

// Klima Infinity specific facets

cut[0] = (
IDiamondCut.FacetCut({
facetAddress: address(c3RedeemF),
action: IDiamondCut.FacetCutAction.Replace,
functionSelectors: generateSelectors("RedeemC3PoolFacet")
facetAddress: address(retireICRF),
action: IDiamondCut.FacetCutAction.Add,
functionSelectors: generateSelectors("RetireICRFacet")
})
);

cut[1] = (
IDiamondCut.FacetCut({
facetAddress: address(c3RetireF),
action: IDiamondCut.FacetCutAction.Replace,
functionSelectors: generateSelectors("RetireC3C3TFacet")
})
);

cut[2] = (
IDiamondCut.FacetCut({
facetAddress: address(toucanRedeemF),
action: IDiamondCut.FacetCutAction.Replace,
functionSelectors: generateSelectors("RedeemToucanPoolFacet")
})
);

cut[3] = (
IDiamondCut.FacetCut({
facetAddress: address(toucanRetireF),
action: IDiamondCut.FacetCutAction.Replace,
functionSelectors: generateSelectors("RetireToucanTCO2Facet")
})
);

cut[4] = (
IDiamondCut.FacetCut({
facetAddress: address(retireCarbonF),
action: IDiamondCut.FacetCutAction.Replace,
functionSelectors: generateSelectors("RetireCarbonFacet")
})
);

cut[5] = (
IDiamondCut.FacetCut({
facetAddress: address(retireSourceF),
action: IDiamondCut.FacetCutAction.Replace,
functionSelectors: generateSelectors("RetireSourceFacet")
})
);

cut[6] = (
IDiamondCut.FacetCut({
facetAddress: address(retirementQuoterF),
action: IDiamondCut.FacetCutAction.Replace,
functionSelectors: generateSelectors("RetirementQuoter")
facetAddress: address(erc1155ReceiverF),
action: IDiamondCut.FacetCutAction.Add,
functionSelectors: generateSelectors("ERC1155ReceiverFacet")
})
);

Expand Down
Loading

0 comments on commit 8a1f1da

Please sign in to comment.